using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using Microsoft.Practices.PageFlow;
using WCSFContrib.ECommerceCatalog.User.PageFlows;

namespace WCSFContrib.ECommerceCatalog.User.Services
{
    public class NavigationService : INavigationService
    {
        private IPageFlow _userPageFlow;
        private IPageFlowProvider _pageFlowProvider;


        public IPageFlowProvider PageFlowProvider
        {
            set { _pageFlowProvider = value; }
        }

        public IPageFlow UserPageFlow
        {
            get
            {
                if (_userPageFlow == null && _pageFlowProvider != null)
                {
                    _userPageFlow = _pageFlowProvider.GetPageFlow(typeof(UserPageFlow));
                }

                return _userPageFlow;
            }
        }

        #region INavigationService Members

        public void GoCheckout()
        {
            //HttpContext.Current.Response.Redirect("~/User/Checkout.aspx");
            UserPageFlow.Navigate("doCheckout");
        }

        public void GoUserInfo()
        {
            //HttpContext.Current.Response.Redirect("~/User/Default.aspx");
            UserPageFlow.Navigate("successCheckout");
        }

        public void GoCart()
        {
            UserPageFlow.Navigate("goCart");
        }

        public void GoPageFlowError()
        {
            UserPageFlow.Navigate("goBack");
        }

        #endregion
    }
}
